<?php

BaseMvc::includeLib('Listener', 'basemvc', true);

class ListernerHandler
{

    private $listeners = array();

    public function broadCastEventOf($type, $information = false) {
        if (!empty($this->listeners[$type])) {
            foreach ($this->listeners[$type] as $listener) {
                $listener->actionPreformed($information);
            }
        }
    }

    public function addListenerTo($type, Listener $listener) {
        $this->listeners[$type][] = $listener;
    }

    public function includeListener($fileName, $map = false, $once = true) {
        BaseMvc::includeFile(BASE_DIR_LISTENERS, $fileName, $map, $once);
    }

}
